package com.example.springbootstudy.dao;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Repository;

import javax.annotation.PostConstruct;

@Repository
@Slf4j
public class UserDAO {

    @Value("${spring.datasource.url}")
    private String url;

    @Value("${spring.datasource.username}")
    private String username;

    @Value("${spring.datasource.password}")
    private String password;

    //初始化方法：模拟连接数据库，执行sql
    @PostConstruct
    public void init(){
        //模拟连接
        System.out.println(url);
        System.out.println(username);
        System.out.println(password);
        log.debug("================================debug");
        log.info("================================info");
        log.warn("================================warn");
        log.error("================================error");
    }
}
